{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfbase1.css?v={$version}"/>
</head>
<body>
<div class="layui-form">
<div class="layui-fluid"  style="padding-bottom:83px;border:0;">
<div class="layui-card">
<blockquote class="layui-elem-quote">
    发布/编辑文档时，会同步更新sitemap.xml，包含首页、栏目页、指定数量的最新发布文档<br>
    推荐设置100篇，数量设置越多，会对文档发布/编辑的速度造成一定影响。<br>
</blockquote>
<div style="height:100%;max-width:600px;">
<div class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">自动生成</label>
        <div class="layui-input-inline">
            <input type="checkbox" name="sitemap_auto" lay-filter="sitemap_auto" value="{$config.sitemap_auto|default='0'}" lay-skin="switch" lay-text="开启|关闭" {notempty name="$config.sitemap_auto"}checked{/notempty}>  
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">Sitemap类型</label>
        <div class="layui-input-block">
            <input type="checkbox" lay-skin="primary" name="sitemap_xml" value="1" title="XML地图" {eq name="$config.sitemap_xml" value="1"}checked{/eq}>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">生成文档数</label>
        <div class="layui-input-block">
        <input type="text" name="sitemap_archives_num" value="{$config.sitemap_archives_num}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">实时推送Url的token</label>
        <div class="layui-input-block">
        <input type="text" name="sitemap_zzbaidutoken" value="{$config.sitemap_zzbaidutoken}" class="layui-input">
        <div class="layui-input-block2" style="padding:10px 0;">这里填入 <a href="https://ziyuan.baidu.com" target="_blank" style="color:red;">百度搜索资源平台</a> 的准入密钥，才能第一时间推送文章链接给百度蜘蛛。</div>
        </div>
    </div>
</div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
</div>
<div style="clear:both;"></div>
</div>
</div>
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        // 监听开关
        form.on('switch', function(data){
          var elemId = data.elem.attributes['lay-filter']['nodeValue'];
          if (data.elem.checked) {
            this.value = 1;
          } else {
            this.value = 0;
          }
          $("input[name='"+elemId+"']").val(this.value);
        });
        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.load(2);
            $.ajax({
                type : 'post',
                url : "{:url('/channel.sitemap/index')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll('loading');
                    if(res.status){
                        layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                            window.location.reload();
                        });
                    }else{
                      layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll('loading');
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
        });
    });
</script>
</body>
</html>